/**
  SUNNY Project, Anyang Normal University, IMP-CAS
  \class TAMBSDManager
  \brief A class to generate many-body basis and manage TAMBSDList objects.
  \author SUN Yazhou
  \since 2020/02/01
  \date Last modified: 2020/02/10 by SUN Yazhou
  \copyright SUNNY project, Anyang Normal University, IMP-CAS
*/

#ifndef _TAMBSDManager_h_
#define _TAMBSDManager_h_

#include <vector>
#include <string>
#include "types.h"

using std::vector;
using std::string;

class TAMBSD;
class TAMBSDList;

class TAMBSDManager{
public:
  virtual ~TAMBSDManager();
  static TAMBSDManager *Instance();
  /// assign nparticle, nspstate, 2*M and the spstate space
  virtual void LoadConfigFile(const string &file);
  virtual void GenerateManyBodySD();
  virtual void MSchemeGo(); ///< generate the M-scheme many-body state basis
  TAMBSDList *GetMBSDListM();
  int GetNParticle() const{ return fNParticle; }
  int GetNSPState() const{ return fNSPState; }
  int Get2M() const{ return f2M; }
  /// \param opt: 1->Print; 2->PrintInBit; 3->Print both; otherwise->brief
  virtual void Print(int opt = 1);
  bool MBSDFilter(ull bit) const; ///< filter mbsds

protected:
  TAMBSDManager();

  static TAMBSDManager *kInstance;
  TAMBSDList *fMBSDListM; ///< M-scheme many-body basis
  string fCfgFile;

  // user input info
  int fNParticle, fNSPState;
  // set to true if parity is undefined in the YAML cnofig file
  bool fBothParity; ///< true: + and - are both allowed; default: false
  int f2M; ///< the uniform M*2 for this list
	int f2T; ///< the uniform T*2 for this list
	bool fParity; ///< total parity: true: +; false: -
	bool fIsPair; ///< true: exclude broken pairs; false: include broken pairs
};

#endif
